<?php


namespace App\Model;


use Carbon\Carbon;

class OrderMention extends Base
{
    protected $table='order_mention';

    protected $fillable=['order_id','start_time','end_time'];

    protected $appends=['is_time'];


    function getStartTimeAttribute($value)
    {

        if(!$value) return '';

        return Carbon::parse($value)->format('Y-m-d H:i');

    }


    function getEndTimeAttribute($value)
    {

        if(!$value) return '';

        return Carbon::parse($value)->format('Y-m-d H:i');

    }


    /**
     * 是否到提货时间，当前时间大于开始时间就可以提货
     * Create by PeterYang
     * 2020/07/04 11:17:06
     * Email:904801074@qq.com
     * @return bool
     */
    function  getIsTimeAttribute()
    {

        $start_time=$this->attributes['start_time'];

        return now()->gt(Carbon::parse($start_time));

    }

}
